// 统一管理购物车相关的接口
import ajax from "@/utils/ajax";
import { reqUserInfo } from "../Register";

export function getCartData() {
    return ajax({
        url: '/api/cart/cartList',
        method: 'get',
    });
}

export function updateCartNumber(skuId, skuNum) {
    return ajax({
        url: `/api/cart/addToCart/${skuId}/${skuNum}`,
        method: 'post'
    })
}


// 修改购物车中商品的选中状态
export const reqChangeChecked = (skuID,isChecked)=> ajax.get(`/api/cart/checkCart/${skuID}/${isChecked}`)

// 批量选中购物车
export const reqCheckAllCart = (isChecked,idList)=> ajax.post(`/api/cart/batchCheckCart/${isChecked}`,idList)


// 删除购物车中当前商品
export const reqDeletOneSku = (skuId) => ajax.delete(`/api/cart/deleteCart/${skuId}`)

// 批量删除购物车中的商品
export const  reqDeleteSomeSku = (idList)=> ajax.post(`/api/cart/batchDeleteCart`,idList)